CONTENTS | INDEX | PREV | NEXT
fclose
NAME
fclose - close a file pointer
SYNOPSIS
#include <stdio.h>
int error = fclose(fp);
FILE *fp;
FUNCTION
fclose flushes any data remaining in the file pointer's
output buffer to the file and then closes the file. The
file pointer is no longer valid.
fclose returns any error condition that occured while flushing
the buffered data to the file. The file is still closed even
if an error occurs.
NOTE
You can fclose(stdin), fclose(stdout), and fclose(stderr) as
you wish to save space and/or detach your process from the
console (i.e. allow the console window to be closed).
WARNING
If you fclose stdin, stdout, and stderr with the intension of
removing all references to the console window there is still
one more thing you have to do, and that is put a NULL in
your processes pr_ConsoleTask field. Otherwise, while the
console window will be able to close, your process will still
have a reference to the now non existant window if it attempts
to spawn or Execute() other processes.
refer to the file_pointer manual page for general information
INPUTS
FILE *fp; file pointer
RESULTS
int error; error on fclose, or 0 if none
SEE ALSO
fopen, fread, fwrite, fgets, fputs